/*
 *  JDiv - API for Multimedia Application
 *  http://jdiv.sourceforge.net 
 *  ------------------------------------
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software 
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 *
 */

package com.jdiv.functions;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture.TextureFilter;
import com.jdiv.Const;
import com.jdiv.kernel.JDivSystem;

/** Class which controls the operation of JDiv. */
public class FunctionsSystem {
	 
	/** @return Version of JDiv.*/
	 public String getVersion(){
	  return "[ JDiv 1.0 ] for LibGdx 0.9.8";	 
	 }
	 
	/**
	 * @return Frames per Second thats works.
	 */
	 
	 public int getFps(){
		 return JDivSystem.getFps(); 
	 }
	 
	 /** Enable Debug Mode.  
	  */
	 
	 public void enableDebugMode( ){
		 JDivSystem.debugModeShowActivity = true;
		 JDivSystem.debugModeDrawPoly     = false;
		 JDivSystem.debugMode = true;
	 }
	 
	 /** Enable Debug Mode.  
	  * @param showActivity If true show JDiv internal activity.
	  * @param drawPolygonal If true draws the polygon collision. 
	  */
	 
	 public void enableDebugMode( boolean showActivity, boolean drawPolygonal ){
		 JDivSystem.debugModeShowActivity = showActivity;
		 JDivSystem.debugModeDrawPoly     = drawPolygonal;
		 JDivSystem.debugMode             = true;
	 }
	 
	 /** Disable Debug Mode. */
	 
	 public void disableDebugMode(){
		 JDivSystem.debugMode             = false;
		 JDivSystem.debugModeShowActivity = false;
		 JDivSystem.debugModeDrawPoly     = false;
	 }
	 
	 /**
	  * Sets Frames per Second thats program works.
	  * @param nfps Number of frames per second.
	  */

	 public void setFps( int nfps ){
		 if( nfps <= 0 )
			 JDivSystem.setFps(100);
		 else
			 JDivSystem.setFps(nfps);
	 }
	 
	 /**
	  * Sets scale filtering of images.
	  * @param filter initial its "Const.FILTER_LINEAR.", This function must be call before load any image, text, or effect. 
	  *  <p> The possible values are:
	  *  <p>{@link com.jdiv.Const#FILTER_LINEAR}: Linear filtering.
	  *  <p>{@link com.jdiv.Const#FILTER_NEAREST}: Nearest filtering.
	  *  <p></p> 
	  */
	 
	 public void setScaleFilter( int filter ){
		 switch( filter ){
		  case Const.FILTER_LINEAR : JDivSystem.jdivTextureFilter = TextureFilter.Linear; break;
		  case Const.FILTER_NEAREST: JDivSystem.jdivTextureFilter = TextureFilter.Nearest; break;
		 }
	 }
	 
	 /**
	  * Key to close the program defaults to "Keys.ESCAPE". 
	  * @param KeyEscape
	  */

	 public void setKeyEscape( int KeyEscape ){
		 JDivSystem.enableKeyEscape = true;
		 JDivSystem.keyEscape = KeyEscape;
	 }

	 /** Disable key to close program. */
	 
	 public void disableKeyEscape(){
		 JDivSystem.enableKeyEscape = false;
	 }
	 
	 /**
	  * Exit the JDiv program.
	  */

	 public void exit( ){
		 JDivSystem.jdivExit = true;
	 }
	 
	 /**
	  * Displays a message on the console.
	  * @param info What happened?.
	  */
	 
	 public void log( String info )
	 {
		if( info != null ){
		 JDivSystem.debugLog = info;
		 Gdx.app.log("", info);
		}
	 }
}
